package com.mrd.gtimpframe.entity;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * T_BIZ_NOTICE
 *
 * @author dusy  2017-11-29 公告表
 */
public class Notice implements Serializable {
    /**
     * id
     */
    private String id;

    /**
     * 适用角色(角色间用逗号分隔，保存角色id)
     */
    private String appliedRoles;

    /**
     * 是否最新发布 0：是，1：否
     */
    private String newPublish;

    /**
     * 最新发布适用的角色(角色间用逗号分隔，保存角色id)
     */
    private String newPublishRoles;

    /**
     * 状态  0：草稿，1：生效，2：删除
     */
    private String state;

    /**
     * 备注
     */
    private String remark;

    /**
     * 创建时间
     */
    private Date createTime;

    /**
     * 修改时间
     */
    private Date modifyTime;

    /**
     * 创建者
     */
    private String creator;

    /**
     * 修改人
     */
    private String modifier;

    /**
     * 系统版本号
     */
    private String systemVersion;

    /**
     * 以json格式保存list,元素为图片地址
     */
    private String pictures;

    /**
     * 标题
     */
    private String title;

    private List<String> pictureList;

    /**
     * T_BIZ_NOTICE
     */
    private static final long serialVersionUID = 1L;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id == null ? null : id.trim();
    }

    public String getAppliedRoles() {
        return appliedRoles;
    }

    public void setAppliedRoles(String appliedRoles) {
        this.appliedRoles = appliedRoles == null ? null : appliedRoles.trim();
    }

    public String getNewPublish() {
        return newPublish;
    }

    public void setNewPublish(String newPublish) {
        this.newPublish = newPublish == null ? null : newPublish.trim();
    }

    public String getNewPublishRoles() {
        return newPublishRoles;
    }

    public void setNewPublishRoles(String newPublishRoles) {
        this.newPublishRoles = newPublishRoles == null ? null : newPublishRoles.trim();
    }

    public String getState() {
        return state;
    }

    public void setState(String state) {
        this.state = state == null ? null : state.trim();
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark == null ? null : remark.trim();
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getModifyTime() {
        return modifyTime;
    }

    public void setModifyTime(Date modifyTime) {
        this.modifyTime = modifyTime;
    }

    public String getCreator() {
        return creator;
    }

    public void setCreator(String creator) {
        this.creator = creator == null ? null : creator.trim();
    }

    public String getModifier() {
        return modifier;
    }

    public void setModifier(String modifier) {
        this.modifier = modifier == null ? null : modifier.trim();
    }

    public String getSystemVersion() {
        return systemVersion;
    }

    public void setSystemVersion(String systemVersion) {
        this.systemVersion = systemVersion == null ? null : systemVersion.trim();
    }

    public String getPictures() {
        return pictures;
    }

    public void setPictures(String pictures) {
        this.pictures = pictures == null ? null : pictures.trim();
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title == null ? null : title.trim();
    }

    public List<String> getPictureList() {
        if ((pictureList == null || pictureList.size() == 0) && pictures != null) {
            pictureList = new ArrayList<>();
            for (String picturePath : pictures.split(",")) {
                pictureList.add("/notice/picture/" + id + "?fileName=" + picturePath);
            }
        }
        return pictureList;
    }

    public void setPictureList(List<String> pictureList) {
        this.pictureList = pictureList;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", appliedRoles=").append(appliedRoles);
        sb.append(", newPublish=").append(newPublish);
        sb.append(", newPublishRoles=").append(newPublishRoles);
        sb.append(", state=").append(state);
        sb.append(", remark=").append(remark);
        sb.append(", createTime=").append(createTime);
        sb.append(", modifyTime=").append(modifyTime);
        sb.append(", creator=").append(creator);
        sb.append(", modifier=").append(modifier);
        sb.append(", systemVersion=").append(systemVersion);
        sb.append(", pictures=").append(pictures);
        sb.append(", title=").append(title);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}